﻿package classes 
{
	import alternativa.engine3d.core.Object3D;
	import alternativa.engine3d.materials.FillMaterial;
	import alternativa.engine3d.materials.WireMaterial;
	import alternativa.engine3d.primitives.Plane;
	
	import alternativa.engine3d.events.MouseEvent3D;
	
	import flash.display.BlendMode;

	public class showFloor3D extends Object3D
	{
		private var obj3d:Object3D;
		private var floor:Plane;
		
		public function showFloor3D(widthX:Number = 100, widthY:Number = 100):void
		{
			obj3d = new Object3D();
			
			// Plane(width:Number = 100, length:Number = 100, widthSegments:uint = 1, lengthSegments:uint = 1, twoSided:Boolean = true, reverse:Boolean = false, triangulate:Boolean = false)
			floor = new Plane(widthX, widthY, 10, 10, true, false, false);
			//floor.cloneMaterialToAllSurfaces(new WireMaterial(1, 0xFFFFFF));
			floor.cloneMaterialToAllSurfaces(new FillMaterial(0xFFFFFF, 0.5, BlendMode.NORMAL, 1, 0x000000));
			
			floor.addEventListener(MouseEvent3D.CLICK, function(e:MouseEvent3D):void { trace(e.target); } );
			
			obj3d.addChild(floor);
			addChild(obj3d);
		}
		
	}

}